﻿<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Master_Page/Master_Popup.Master"
    CodeBehind="RelationMeterial.aspx.vb" Inherits="I_PORT.RelationMeterial" MaintainScrollPositionOnPostback="true"
    title="IRPC INTELLIGENT PORT SERVICE" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<%@ Register Src="~/Control/Confirm.ascx" TagName="Confirm1" TagPrefix="Confirm" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <script type="text/javascript" language="javascript">
                var _source;
    // keep track of the popup div
    var _popup;

    function showConfirm(customerid) {
        this._source = customerid;
        this._popup = $find('ModalPopupExtender3'); 
        this._popup.show();  
    }
       function okClick(){
        //  find the confirm ModalPopup and hide it
       this._popup.hide();

        __doPostBack(this._source.name,'');
        
    }
    
    function cancelClick(){
        //  find the confirm ModalPopup and hide it
        this._popup.hide();
    }
            function checkNumber(e)
{
var keycode;

if (window.event) keycode = window.event.keyCode; // ใช้ IE อ่ะ

else if (e) keycode = e.which; // ใช้ Firefox เน่าะ

 if (((keycode > 47) && (keycode < 58))||(keycode == 190)||(keycode == 46))
 {
 return true;
 }
return false;
}
    </script>

    <table width="100%" border="0" cellpadding="2" cellspacing="0">
        <tr>
            <td style="width: 20%;" align="right">
                <asp:Label ID="lbMat" runat="server" SkinID="lbtxt" Text="Meterial :"></asp:Label>&nbsp;
            </td>
            <td align="left">
                <asp:Label ID="lbCode" runat="server" Text="" SkinID="lbtxt"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 20%;" align="right">
                <asp:Label ID="lbMatName" runat="server" SkinID="lbtxt" Text="Name :"></asp:Label>&nbsp;
            </td>
            <td align="left">
                <asp:Label ID="lbName" runat="server" Text="" SkinID="lbtxt"></asp:Label>
            </td>
        </tr>
        <tr>
            <td style="width: 20%;" align="right">
                <asp:Label ID="lbUnit" runat="server" SkinID="lbtxt" Text="Per/Unit :"></asp:Label>&nbsp;
            </td>
            <td align="left">
                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="left">
                            <asp:DropDownList ID="ddlPer" runat="server" SkinID="ddl">
                                <asp:ListItem Value="">Nothing</asp:ListItem>
                                <asp:ListItem Value="TON">TON</asp:ListItem>
                                <asp:ListItem Value="Day">Day</asp:ListItem>
                                <asp:ListItem Value="Hour">Hour</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td style="width: 20%;" align="right">
                <asp:Label ID="lbWHT" runat="server" SkinID="lbtxt" Text="Withoding Tax :"></asp:Label>&nbsp;
            </td>
            <td align="left">
                <asp:DropDownList ID="ddlWHT" runat="server" SkinID="ddl">
                    <asp:ListItem Value="00">ไม่ถูกหัก ณ ที่จ่าย </asp:ListItem>
                    <asp:ListItem Value="01">ดอกเบี้ยรับ 1%</asp:ListItem>
                    <asp:ListItem Value="02">ค่าขนส่ง 1%</asp:ListItem>
                    <asp:ListItem Value="03">จากหน่วยงานราชการ 1%</asp:ListItem>
                    <asp:ListItem Value="04">ค่าจ้างทำของ 3%</asp:ListItem>
                    <asp:ListItem Value="05">ค่าบริการอื่นๆ 3%</asp:ListItem>
                    <asp:ListItem Value="06">ค่าเช่า 5%</asp:ListItem>
                    <asp:ListItem Value="22">เงินรางวัล 5%</asp:ListItem>
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <asp:UpdatePanel ID="UpdatePanelDefault" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <table width="100%" border="0" cellpadding="2" cellspacing="0">
                            <tr>
                                <td style="width: 20%;" align="right">
                                    <asp:Label ID="Label5" runat="server" SkinID="lbtxt" Text="Default:"></asp:Label>&nbsp;
                                </td>
                                <td align="left">
                                    <asp:CheckBoxList ID="chkDefault" RepeatDirection="Horizontal" runat="server" SkinID="chk">
                                        <asp:ListItem Value="L">Liquid</asp:ListItem>
                                        <asp:ListItem Value="B">Bulk</asp:ListItem>
                                    </asp:CheckBoxList>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 20%;" align="right">
                                    <asp:Label ID="Label6" runat="server" SkinID="lbtxt" Text="เมื่อเกิด Shifting :"></asp:Label>&nbsp;
                                </td>
                                <td align="left">
                                   <asp:Label ID="Label7" runat="server" SkinID="lbtxt" Text="จะทำการเพิ่มจำนวนขึ้นอีก"></asp:Label>&nbsp;<asp:TextBox ID="txtShifting" runat="server" Text="0" Width="40px"  onkeypress="return checkNumber(this);"  ></asp:TextBox>&nbsp;<asp:Label ID="Label10" runat="server" SkinID="lbtxt" Text="หน่วย"></asp:Label>
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td align="center" colspan="2">
                <asp:UpdatePanel ID="UpdatePanelCompute" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <fieldset style="width: 95%">
                            <legend style="color: #848585; font-family: Tahoma; font-size: 14px; font-weight: bold;">
                                การคำนวณเงิน</legend>
                            <table width="100%" border="0" cellpadding="2" cellspacing="0">
                                <tr>
                                    <td style="width: 20%;" align="right">
                                        <asp:Label ID="Label9" runat="server" SkinID="lbtxt" Text="คำนวณเงิน :"></asp:Label>&nbsp;
                                    </td>
                                    <td align="left">
                                        <asp:RadioButtonList ID="radioCompute" runat="server" SkinID="raio"
                                            RepeatDirection="Horizontal">
                                            <asp:ListItem Selected="True" Value="A">คำนวณเงินเมื่อ</asp:ListItem>
                                            <asp:ListItem Value="B">ไม่คำนวณเงินเมื่อ</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center">
                                        <table width="100%" border="0" cellpadding="2" cellspacing="0">
                                            <tr>
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label16" runat="server" SkinID="lbtxt" Text="Buyer/Seller :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    <asp:RadioButtonList ID="radioBuyerSeller" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                                        <asp:ListItem Value="I">IRPC</asp:ListItem>
                                                        <asp:ListItem Value="O">ลูกค้า</asp:ListItem>
                                                        <asp:ListItem Value="A" Selected="True">ทั้งหมด</asp:ListItem>
                                                    </asp:RadioButtonList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label15" runat="server" SkinID="lbtxt" Text="สัญชาติเรือ :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    <asp:RadioButtonList ID="radioNationalCompute" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                                        <asp:ListItem Value="T">ไทย</asp:ListItem>
                                                        <asp:ListItem Value="O">ต่างประเทศ</asp:ListItem>
                                                        <asp:ListItem Value="A" Selected="True">ทุกสัญชาติ</asp:ListItem>
                                                    </asp:RadioButtonList>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label11" runat="server" SkinID="lbtxt" Text="Destination :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    <asp:RadioButtonList ID="radio_DestionationCompute" runat="server" SkinID="raio"
                                                        AutoPostBack="true" RepeatDirection="Horizontal">
                                                        <asp:ListItem Value="T">ในประเทศ</asp:ListItem>
                                                        <asp:ListItem Value="O">ต่างประเทศ</asp:ListItem>
                                                        <asp:ListItem Value="A" Selected="True">ทั้งหมด</asp:ListItem>
                                                    </asp:RadioButtonList>
                                                </td>
                                            </tr>
                                            <tr id="rowTypebuyCompute" runat="server" visible="false">
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label12" runat="server" SkinID="lbtxt" Text="รูปแบบการซื้อขาย :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    <asp:RadioButtonList ID="radioTypeBuyCompute" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                                        <asp:ListItem Value="F">FOB</asp:ListItem>
                                                        <asp:ListItem Value="O">อื่นๆ</asp:ListItem>
                                                        <asp:ListItem Value="A" Selected="True">ทั้งหมด</asp:ListItem>
                                                    </asp:RadioButtonList>
                                                </td>
                                            </tr>
                                             <tr>
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label4" runat="server" SkinID="lbtxt" Text="DWT :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    &nbsp;<asp:DropDownList ID="ddlOperate" runat="server" SkinID="ddl" ><asp:ListItem Value="L"><</asp:ListItem><asp:ListItem Value="H">></asp:ListItem></asp:DropDownList><asp:TextBox ID="txtDWToperate" runat="server" Width="90px" Text="0" onkeypress="return checkNumber(this);" ></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label21" runat="server" SkinID="lbtxt" Text="กลุ่มสินค้า :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    <asp:RadioButtonList ID="radioComputeProduct" runat="server" SkinID="raio" AutoPostBack="true"
                                                        RepeatDirection="Horizontal">
                                                        <asp:ListItem Value="A" Selected="True">ทุกกลุ่มสินค้า</asp:ListItem>
                                                        <asp:ListItem Value="B">เฉพาะกลุ่มสินค้าดังนี้</asp:ListItem>
                                                        <asp:ListItem Value="C">ทุกกลุ่มสินค้ายกเว้นสินค้าดังนี้</asp:ListItem>
                                                    </asp:RadioButtonList>
                                                </td>
                                            </tr>
                                            <tr id="rowComputeProduct1" runat="server" visible="false">
                                                <td colspan="2" align="center">
                                                    <table width="100%" border="0" cellpadding="2" cellspacing="0">
                                                        <tr>
                                                            <td style="width: 20%;" align="right">
                                                                <asp:Label ID="Label23" runat="server" SkinID="lbtxt" Text="กลุ่มสินค้า :"></asp:Label>&nbsp;
                                                            </td>
                                                            <td align="left">
                                                                <asp:TextBox ID="txtComputeProduct1" runat="server" MaxLength="200"></asp:TextBox>&nbsp;<asp:Button
                                                                    ID="btnComputeProduct1" runat="server" Text="เพิ่ม สินค้า" CssClass="ButtonStyle" />
                                                                <asp:AutoCompleteExtender runat="server" ID="AutoCompleteExtender4" BehaviorID="AutoCompleteExComputeProduct1"
                                                                    CompletionInterval="50" TargetControlID="txtComputeProduct1" ServicePath="../WebService/AutoComplete_IPORT.asmx"
                                                                    MinimumPrefixLength="3" ServiceMethod="GetGroupProduct" CompletionListCssClass="autocomplete_completionListElement"
                                                                    CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem">
                                                                    <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteExComputeProduct1');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteExComputeProduct1')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteExComputeProduct1')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                                                                    </Animations>
                                                                </asp:AutoCompleteExtender>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" align="center">
                                                                <asp:GridView ID="gridComputeProduct1" runat="server" SkinID="gridblueNoPage" DataKeyNames="Product_name,Product_no"
                                                                    AutoGenerateColumns="False">
                                                                    <Columns>
                                                                        <asp:BoundField HeaderText="สินค้า" DataField="Product_name" />
                                                                        <asp:TemplateField HeaderText="Operation" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Center">
                                                                            <ItemTemplate>
                                                                                <asp:CheckBoxList ID="chkAction" SkinID="chk" runat="server" RepeatDirection="Horizontal">
                                                                                    <asp:ListItem Selected="True">Load</asp:ListItem>
                                                                                    <asp:ListItem Selected="True">Disch</asp:ListItem>
                                                                                    <%--  <asp:ListItem Selected="True">Load(IRPC)</asp:ListItem>
                            <asp:ListItem Selected="True">Disch(IRPC)</asp:ListItem>--%>
                                                                                </asp:CheckBoxList>
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>"
                                                                                    OnClientClick="showConfirm(this); return false;" runat="server" ImageUrl="~/Image/cancel-24.gif" />
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr id="rowComputeProduct2" runat="server" visible="false">
                                                <td colspan="2" align="center">
                                                    <table width="100%" border="0" cellpadding="2" cellspacing="0">
                                                        <tr>
                                                            <td style="width: 20%;" align="right">
                                                                <asp:Label ID="Label25" runat="server" SkinID="lbtxt" Text="กลุ่มสินค้า :"></asp:Label>&nbsp;
                                                            </td>
                                                            <td align="left">
                                                                <asp:TextBox ID="txtComputeProduct2" runat="server" MaxLength="200"></asp:TextBox>&nbsp;<asp:Button
                                                                    ID="btnComputeProduct2" runat="server" Text="เพิ่ม สินค้า" CssClass="ButtonStyle" />
                                                                <asp:AutoCompleteExtender runat="server" ID="AutoCompleteExtender5" BehaviorID="AutoCompleteExComputeProduct2"
                                                                    CompletionInterval="50" TargetControlID="txtComputeProduct2" ServicePath="../WebService/AutoComplete_IPORT.asmx"
                                                                    MinimumPrefixLength="3" ServiceMethod="GetGroupProduct" CompletionListCssClass="autocomplete_completionListElement"
                                                                    CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem">
                                                                    <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteExComputeProduct2');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteExComputeProduct2')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteExComputeProduct2')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                                                                    </Animations>
                                                                </asp:AutoCompleteExtender>
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td colspan="2" align="center">
                                                                <asp:GridView ID="gridComputeProduct2" runat="server" SkinID="gridblueNoPage" DataKeyNames="Product_name,Product_no"
                                                                    AutoGenerateColumns="False">
                                                                    <Columns>
                                                                        <asp:BoundField HeaderText="สินค้า" DataField="Product_name" />
                                                                        <asp:TemplateField HeaderText="Operation" ItemStyle-Wrap="false" ItemStyle-HorizontalAlign="Center">
                                                                            <ItemTemplate>
                                                                                <asp:CheckBoxList ID="chkAction" SkinID="chk" runat="server" RepeatDirection="Horizontal">
                                                                                    <asp:ListItem Selected="True">Load</asp:ListItem>
                                                                                    <asp:ListItem Selected="True">Disch</asp:ListItem>
                                                                                    <%--                            <asp:ListItem Selected="True">Load(IRPC)</asp:ListItem>
                            <asp:ListItem Selected="True">Disch(IRPC)</asp:ListItem>--%>
                                                                                </asp:CheckBoxList>
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                        <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>"
                                                                                    OnClientClick="showConfirm(this); return false;" runat="server" ImageUrl="~/Image/cancel-24.gif" />
                                                                            </ItemTemplate>
                                                                        </asp:TemplateField>
                                                                    </Columns>
                                                                </asp:GridView>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 20%;" align="right">
                                        <asp:Label ID="Label3" runat="server" SkinID="lbtxt" Text="คำนวณเงินกับ :"></asp:Label>&nbsp;
                                    </td>
                                    <td align="left">
                                        <asp:RadioButtonList ID="radioFor" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                            <asp:ListItem Selected="True" Value="A">Ship's Agent(SoldTo)</asp:ListItem>
                                            <asp:ListItem Value="C">เจ้าของสินค้า</asp:ListItem>
                                        </asp:RadioButtonList>
                                    </td>
                                </tr>
                            </table>
                        </fieldset>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
        <tr>
            <td colspan="2" align="center">
                <fieldset style="width: 95%">
                    <legend style="color: #848585; font-family: Tahoma; font-size: 14px; font-weight: bold;">
                        สูตร</legend>
                    <table width="100%" border="0" cellpadding="2" cellspacing="0">
                        <tr>
                            <td colspan="2" align="center">
                                <asp:GridView ID="gridItem" runat="server" SkinID="gridblue" AutoGenerateColumns="False">
                                    <Columns>
                                        <asp:BoundField HeaderText="Name" DataField="Name" />
                                        <asp:BoundField HeaderText="Rate" DataField="Rate" />
                                        <asp:BoundField HeaderText="Unit" DataField="Unit" />
                                        <asp:BoundField HeaderText="Point" DataField="Point" />
                                        <asp:TemplateField HeaderText="แก้ไข" ItemStyle-Width="50px">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="imgedit" CommandName="cmdedit" CommandArgument="<%# Container.DataItemIndex %>"
                                                    runat="server" ImageUrl="~/Image/edit-24.gif" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                        <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>"
                                                    OnClientClick="showConfirm(this); return false;" runat="server" ImageUrl="~/Image/cancel-24.gif" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="LbNameCal" runat="server" SkinID="lbtxt" Text="Name :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtNameCal" runat="server" Width="250px"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" valign="top" align="right">
                                <asp:Label ID="lbRate" runat="server" SkinID="lbtxt" Text="ราคา :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:UpdatePanel ID="UpdatePaneRate" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td style="width: 100px;">
                                                    <asp:RadioButton ID="RadioRate" runat="server" AutoPostBack="true" Checked="true"
                                                        SkinID="raio" Text="ราคาต่อหน่วย" />
                                                </td>
                                                <td style="width: 91px;">
                                                    <asp:TextBox ID="txtRate" runat="server" Width="90px" onkeypress="return checkNumber(this);" Style="text-align: right;"></asp:TextBox>&nbsp;
                                                    <asp:MaskedEditExtender ID="MaskedEditExtender1" runat="server" TargetControlID="txtRate"
                                                        Mask="9,999,999.99" MaskType="Number" AcceptNegative="Left" DisplayMoney="Left"
                                                        InputDirection="RightToLeft">
                                                    </asp:MaskedEditExtender>
                                                </td>
                                                <td align="left">
                                                    <asp:DropDownList ID="ddlRate" runat="server" SkinID="ddl">
                                                        <asp:ListItem Value="Baht">Baht</asp:ListItem>
                                                    </asp:DropDownList>
                                                </td>
                                            </tr>
                                        </table>
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td colspan="3" align="left" style="width: 170px;">
                                                    <asp:RadioButton ID="RadioLOA" runat="server" AutoPostBack="true" Checked="false"
                                                        SkinID="raio" Text="((LOA-5) * Draft) + 10%" />
                                                </td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="Label20" runat="server" SkinID="lbtxt" Text="ราคาขั้นต่ำ :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtLowRate" runat="server" Width="90px" Text="0" onkeypress="return checkNumber(this);" Style="text-align: right;"></asp:TextBox>&nbsp;
                                <asp:DropDownList ID="ddlLowRate" runat="server" SkinID="ddl">
                                    <asp:ListItem Value="Baht">Baht</asp:ListItem>
                                </asp:DropDownList>
                                &nbsp;<asp:Label ID="labelRed" runat="server" SkinID="lbtxtNoColor" Text="กรณีไม่มีราคาขั้นต่ำให้ใส่ 0"
                                    ForeColor="Red"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="lbRelation" runat="server" SkinID="lbtxt" Text="คำนวณจาก :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td style="width: 51px">
                                            <asp:TextBox ID="txtPer" runat="server" MaxLength="10" Width="50px" onkeypress="return checkNumber(this);"></asp:TextBox>
                                        </td>
                                        <td>
                                            &nbsp;<asp:DropDownList ID="ddlUnitCal" runat="server" SkinID="ddl">
                                                <asp:ListItem Value="01">GRT</asp:ListItem>
                                                <asp:ListItem Value="02">L.O.A.</asp:ListItem>
                                                <asp:ListItem Value="03">DWT</asp:ListItem>
                                                <asp:ListItem Value="04">Draft</asp:ListItem>
                                                <asp:ListItem Value="05">Product</asp:ListItem>
                                                <asp:ListItem Value="06">None</asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="lbBetween" runat="server" SkinID="lbtxt" Text="ตั้งแต่ :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                    <tr>
                                        <td style="width: 80px;">
                                            <asp:TextBox ID="txtStart" runat="server" Width="80px" MaxLength="10"></asp:TextBox>&nbsp;
                                        </td>
                                        <td style="width: 20px;" align="left">
                                            <asp:Label ID="lbTo" runat="server" SkinID="lbtxt" Text="ถึง"></asp:Label>
                                        </td>
                                        <td align="left">
                                            <asp:TextBox ID="txtEnd" runat="server" Width="80px" MaxLength="10"></asp:TextBox>
                                        </td>
                                    </tr>
                                </table>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 220px;" align="right">
                                <asp:Label ID="lbID" runat="server" SkinID="lbtxt" Text="ลูกค้า :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:TextBox ID="txtid" runat="server" Width="220px"></asp:TextBox>&nbsp;<asp:Label
                                    ID="Label18" runat="server" SkinID="lbtxt" Text="ราคา :"></asp:Label>&nbsp;<asp:TextBox
                                        ID="txtCustomerRate" runat="server" Width="90px" Style="text-align: right;"></asp:TextBox>&nbsp;<asp:DropDownList
                                            ID="ddlCustomerMoney" runat="server" SkinID="ddl">
                                            <asp:ListItem Value="Baht">Baht</asp:ListItem>
                                        </asp:DropDownList>
                                &nbsp;<asp:Button ID="btnCustomer" runat="server" CssClass="ButtonStyle" Text="เพิ่ม ลูกค้า" />
                                <asp:MaskedEditExtender ID="MaskedEditExtender2" runat="server" TargetControlID="txtCustomerRate"
                                    Mask="9,999,999.99" MaskType="Number" AcceptNegative="Left" DisplayMoney="Left"
                                    InputDirection="RightToLeft">
                                </asp:MaskedEditExtender>
                                <asp:AutoCompleteExtender runat="server" ID="AutoCompleteExtender2" BehaviorID="AutoCompleteEx2"
                                    CompletionInterval="50" TargetControlID="txtid" ServicePath="../WebService/AutoComplete_IPORT.asmx"
                                    MinimumPrefixLength="3" ServiceMethod="GetCustomer" CompletionListCssClass="autocomplete_completionListElement"
                                    CompletionListItemCssClass="autocomplete_listItem" CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem">
                                    <Animations>
                    <OnShow>
                        <Sequence>
                            <%-- Make the completion list transparent and then show it --%>
                            <OpacityAction Opacity="0" />
                            <HideAction Visible="true" />
                            
                            <%--Cache the original size of the completion list the first time
                                the animation is played and then set it to zero --%>
                            <ScriptAction Script="
                                // Cache the size and setup the initial size
                                var behavior = $find('AutoCompleteEx2');
                                if (!behavior._height) {
                                    var target = behavior.get_completionList();
                                    behavior._height = target.offsetHeight - 2;
                                    target.style.height = '0px';
                                }" />
                            
                            <%-- Expand from 0px to the appropriate size while fading in --%>
                            <Parallel Duration=".3">
                                <FadeIn />
                                <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteEx2')._height" />
                            </Parallel>
                        </Sequence>
                    </OnShow>
                    <OnHide>
                        <%-- Collapse down to 0px and fade out --%>
                        <Parallel Duration=".3">
                            <FadeOut />
                            <Length PropertyKey="height" StartValueScript="$find('AutoCompleteEx2')._height" EndValue="0" />
                        </Parallel>
                    </OnHide>
                                    </Animations>
                                </asp:AutoCompleteExtender>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 220px;" align="right">
                            </td>
                            <td align="left">
                                <asp:GridView ID="gridCustomer" runat="server" SkinID="gridblueNoPage" DataKeyNames="Customer_no,Customer_name,Customer_Rate,Customer_Money"
                                    AutoGenerateColumns="False">
                                    <Columns>
                                        <asp:BoundField HeaderText="ชื่อ" DataField="Customer_name" ItemStyle-HorizontalAlign="Center" />
                                        <asp:BoundField HeaderText="Rate" ItemStyle-HorizontalAlign="Center" />
                                        <asp:TemplateField HeaderText="ลบ" ItemStyle-Width="50px" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <asp:ImageButton ID="imgdelete" CommandName="cmddelete" CommandArgument="<%# Container.DataItemIndex %>"
                                                    OnClientClick="showConfirm(this); return false;" runat="server" ImageUrl="~/Image/cancel-24.gif" />
                                            </ItemTemplate>
                                        </asp:TemplateField>
                                    </Columns>
                                </asp:GridView>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="Label17" runat="server" SkinID="lbtxt" Text="คำนวณจาก :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:RadioButtonList ID="radioComputeBettween" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                    <asp:ListItem Selected="True" Value="A">ปริมาณทั้งหมด</asp:ListItem>
                                    <asp:ListItem Value="B">ปริมาณส่วนต่างที่อยู่ในช่วง</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="Label1" runat="server" SkinID="lbtxt" Text="สัญชาติเรือ :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:RadioButtonList ID="radioNation" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                    <asp:ListItem Value="T">ไทย</asp:ListItem>
                                    <asp:ListItem Value="O">ต่างประเทศ</asp:ListItem>
                                    <asp:ListItem Value="A" Selected="True">ทุกสัญชาติ</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                                <asp:Label ID="Label2" runat="server" SkinID="lbtxt" Text="ขนส่ง :"></asp:Label>&nbsp;
                            </td>
                            <td align="left">
                                <asp:RadioButtonList ID="radioDestination" runat="server" SkinID="raio" RepeatDirection="Horizontal">
                                    <asp:ListItem Value="I">ภายในประเทศ</asp:ListItem>
                                    <asp:ListItem Value="O">ระหว่างประเทศ</asp:ListItem>
                                    <asp:ListItem Value="A" Selected="True">ทุกการขนส่ง</asp:ListItem>
                                </asp:RadioButtonList>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:UpdatePanel ID="UpdatePanelCount" runat="server" UpdateMode="Conditional">
                                    <ContentTemplate>
                                        <table width="100%" border="0" cellpadding="2" cellspacing="0">
                                            <tr>
                                                <td style="width: 20%;" align="right">
                                                    &nbsp;
                                                </td>
                                                <td align="left">
                                                    <asp:RadioButtonList ID="radioData3" runat="server" AutoPostBack="true" SkinID="raio"
                                                        RepeatDirection="Horizontal">
                                                        <asp:ListItem Value="S">Standard Time</asp:ListItem>
                                                        <asp:ListItem Value="C">Count</asp:ListItem>
                                                        <asp:ListItem Selected="True" Value="N">None</asp:ListItem>
                                                    </asp:RadioButtonList>
                                                </td>
                                            </tr>
                                            <tr id="rowCount" runat="server" visible="false">
                                                <td style="width: 20%;" align="right">
                                                    <asp:Label ID="Label19" runat="server" SkinID="lbtxt" Text="คำนวณ Count จาก :"></asp:Label>&nbsp;
                                                </td>
                                                <td align="left">
                                                    <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                        <tr>
                                                            <td style="width: 245px;">
                                                                <asp:RadioButtonList ID="radioCount" runat="server" SkinID="raio" AutoPostBack="true"
                                                                    RepeatDirection="Horizontal">
                                                                    <asp:ListItem Value="C">จำนวนการหารตามสูตร</asp:ListItem>
                                                                    <asp:ListItem Value="D">Day</asp:ListItem>
                                                                    <asp:ListItem Value="F">ค่าคงที่</asp:ListItem>
                                                                </asp:RadioButtonList>
                                                            </td>
                                                            <td>
                                                                <asp:TextBox ID="txtCountFix" runat="server" Width="60px"></asp:TextBox>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                        <tr>
                            <td style="width: 20%;" align="right">
                            </td>
                            <td align="left">
                                <asp:Button ID="btnRelation" runat="server" Text="Add Relation" CssClass="ButtonStyle" />
                                <asp:Button ID="btnClear" runat="server" Text="Clear" CssClass="ButtonStyle" />
                            </td>
                        </tr>
                    </table>
                </fieldset>
            </td>
        </tr>
        <tr>
            <td style="width: 20%;" align="right">
            </td>
            <td align="right">
                <asp:Button ID="btnSave" runat="server" Text="บันทึก" CssClass="ButtonStyle" />
                <asp:Button ID="btnclose" runat="server" Text="ยกเลิก" CssClass="ButtonStyle" />
            </td>
        </tr>
    </table>
    <asp:Button ID="BtnTrigger" runat="server" Style="display: none;" />
    <asp:ModalPopupExtender ID="ModalPopupExtender1" BehaviorID="ModalPopupExtender3"
        runat="server" OkControlID="ctl00_contentplaceholder1_ConfirmDelete_btnOk" OnOkScript="okClick();"
        CancelControlID="ctl00_contentplaceholder1_ConfirmDelete_btnNo" OnCancelScript="cancelClick();"
        BackgroundCssClass="Background" DropShadow="false" PopupControlID="PanelConfirm"
        TargetControlID="BtnTrigger">
    </asp:ModalPopupExtender>
    <asp:Panel ID="PanelConfirm" runat="server" Style="display: none;">
        <Confirm:Confirm1 ID="ConfirmDelete" runat="server"></Confirm:Confirm1>
    </asp:Panel>
</asp:Content>
